/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.fpt.session;

import edu.fpt.entity.RomType;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author TuanAnh
 */
@Stateless
public class RomTypeFacade extends AbstractFacade<RomType> implements RomTypeFacadeLocal {
    @PersistenceContext(unitName = "ProjectManagementHotel-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public RomTypeFacade() {
        super(RomType.class);
    }

    @Override
    public int getPrice(String roomtype) {
        int price = 0;
        List<RomType> list = findAll();
        for(RomType ro : list){
            if(ro.getRoomType().equals(roomtype)){
                price = ro.getPrice();
            }
        }
        return price;
    }   
}
